home *** CD-ROM | disk | FTP | other *** search
- #if __SASC
- #include "snap.h"
- #endif
-
- #ifdef LATTICE
- typedef ULONG (*FPTR)();
- #endif
- #ifdef AZTEC_C
- typedef VOID (*FPTR)();
- #endif
-
- IMPORT struct IntuitionBase *IntuitionBase;
- #define LVOActivateWindow -0x01c2L
-
- VOID myActivateWindow();
-
- LONG oldActivateWindow;
-
- STATIC WORD patched = 0;
-
- VOID SafePatch()
- {
- if (!patched) {
- Forbid(); /* I don't expect interrupts to do much intuition */
- oldActivateWindow = (LONG)SetFunction((struct Library *)IntuitionBase,
- LVOActivateWindow, (FPTR)myActivateWindow);
- Permit();
- patched = 1;
- }
- }
-
- VOID SafeRestore()
- {
- if (patched) {
- Forbid();
- (VOID)SetFunction((struct Library *)IntuitionBase,
- LVOActivateWindow, (FPTR)oldActivateWindow);
- Permit();
- patched = 0;
- }
- }
-